//	Game Inventory Class
//	The items are stored in an array.

class Inventory
{
	item_list			=	0

	constructor()
	{
		item_list = []
	}

	function	AddItem(item_name)
	{
		print("Inventory::AddItem(" + item_name + ")")

		item_list.append(item_name)
		DumpInventoryInConsole()
	}

	function	RemoveItem(item_name)
	{
		print("Inventory::RemoveItem(" + item_name + ")")

		local	idx, val
		foreach(idx,val in item_list)
			if (val == item_name)
			{
				item_list.remove(idx)
				DumpInventoryInConsole()
				return	true
			}

		return false
	}

	function	DumpInventoryInConsole()
	{
		local	str,i
		str = "["
			foreach(i in item_list)
				str += (" " + i)
		str += " ]"
		print(str)
	}

	function	FindItem(item_name)
	{
		local	i
		foreach(i in item_list)
			if (i == item_name)
				return	true

		return false
	}
}